
class Person{
    private String name;
    private int age;

    private void eat(){
        System.out.println("吃饭！");
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public void show(){
        System.out.println(name+" "+age);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }
}

class Student{
    private String name;
    private int age;
    private String gender;

    public static String highShool = "三年一班";

    //初始化
    public Student(String name, int age, String gender) {
        this.name = name;
        this.age = age;
        this.gender = gender;
    }
    //修改及类外访问
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getGender() {
        return gender;
    }

    public void setGender(String gender) {
        this.gender = gender;
    }

    public void doClass(){
        System.out.println("上课啦，同学们！");
        fun();
    }

    public static void fun(){
//        System.out.println(this.name);
//        System.out.println(name);
        //静态变量方法里得这样调用非静态成员变量
        Student student = new Student("666",88,"女");
        System.out.println(student.name);
    }
}

class CityInChina{
    private String province;
    private double longitude;
    private double latitude;

    private static String country = "中国";

    public CityInChina(){
        System.out.println("不带参数的构造方法！");
    }

    public CityInChina(String province, double longitude, double latitude) {
        this.province = province;
        this.longitude = longitude;
        this.latitude = latitude;
    }

    public String getProvince() {
        return province;
    }

    public void setProvince(String province) {
        this.province = province;
    }

    public double getLongitude() {
        return longitude;
    }

    public void setLongitude(double longitude) {
        this.longitude = longitude;
    }

    public double getLatitude() {
        return latitude;
    }

    public void setLatitude(double latitude) {
        this.latitude = latitude;
    }

    public static String getCountry() {
        return country;
    }

    static {
        System.out.println("静态代码块-》初始化静态的数据成员/ 提前准备一些数据");
    }
    public static void setCountry(String country) {
        CityInChina.country = country;
    }

    {
        System.out.println("非静态代码块/实例代码块/构造代码块！->初始化非静态的数据成员");
    }
    public static void fun(){
        System.out.println("啊啊啊啊！");
    }
}

public class Text {
    public static void main(String[] args) {
//        CityInChina BeiJing = new CityInChina("BeiJing",116.20,39.56);
//        System.out.println(BeiJing.getProvince());
//        System.out.println(BeiJing.getLongitude());
//        System.out.println(BeiJing.getLatitude());
       // CityInChina ShanXi = new CityInChina();
        CityInChina.fun();
        CityInChina.fun();
    }

    public static void main8(String[] args) {
        System.out.println( CityInChina.getCountry());
    }

    public static void main7(String[] args) {
        Student stu = new Student("777",99,"男");
        stu.doClass();

    }

    public void func(){
        System.out.println("烦死了！");
    }
    public static void func2(){
        System.out.println("aaaaaaaaaa");
        System.out.println("vvvvvvvvvvvvvv");
        System.out.println("嗷嗷嗷！");
        {
            //这块代码的执行 不需要条件
            int a = 10;
            System.out.println("定义在方法内部的代码块！普通代码块！");
        }
    }

    public static void main6(String[] args) {
        Text funcc = new Text();
        funcc.func();
        func2();
    }

    public static void main5(String[] args) {
        //Student.doClass();
    }
    public static void main4(String[] args) {
        Student student = null;
        //System.out.println(student.getName());
        System.out.println(student.highShool);
    }
    public static void main3(String[] args) {
        System.out.println(Student.highShool);
    }
    public static void main2(String[] args) {
        Student student1 = new Student("张帅",17,"男");
        Student student2 = new Student("莉丝",16,"女");
        Student student3 = new Student("荷包",19,"男");
        System.out.println(student1.highShool);
        System.out.println(student2.highShool);
        System.out.println(student3.highShool);
        System.out.println(Student.highShool);
    }

    public static void main1(String[] args) {
        Person person1 = new Person("吹画",33);
        person1.show();
        person1.setName("翠花");
        person1.setAge(35);
        System.out.println(person1.getName());
        System.out.println(person1.getAge());
        person1.show();

    }
}
